package com.lanou.shunke.admin.controller;

import com.lanou.shunke.admin.entity.TimeLine;
import com.lanou.shunke.admin.entity.TimelineClassification;
import com.lanou.shunke.admin.service.TimelineService;

import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@RestController
@RequestMapping("/timeline")
public class TimelineAction {
    @Autowired
    private TimelineService service;

    @ApiOperation("查看所有碎片")
    @GetMapping("/showAll")
    public List<TimeLine> showAllTL(@RequestParam(defaultValue = "1") int pageNum,
                                    @RequestParam(defaultValue = "10") int pageSize) {
        return service.showAllTL(pageNum, pageSize);
    }

    @ApiOperation("按照碎片分类查询碎片")
    @GetMapping("/showTagType")
    public List<TimeLine> showTagType(@RequestParam(defaultValue = "1") int pageNum,
                                      @RequestParam(defaultValue = "10") int pageSize
            , int tagId) {
        return service.showTypeTag(pageNum, pageSize, tagId);
    }

    @ApiOperation("查看碎片分类")
    @RequestMapping("/showType")
    public List<TimelineClassification> showType() {
        return service.showType();
    }

    @ApiOperation("修改碎片分类")
    @RequestMapping("/updateTagType")
    public void updateTagType(String tag,int tagId){
        service.updateTagType(tag,tagId);
    }
   //@ApiOperation("修改碎片分类图片")
    @ApiOperation("查看被举报的碎片")
    @RequestMapping("/showBanTL")
    public List<TimeLine> showBanTL(){
        return service.showBanTL();
    }
    @ApiOperation("对举报的碎片进行处理")
    @RequestMapping("/delBanTL")
    public void delBanTL(String timelineId){
        service.delBanTL(timelineId);
    }







}
